#!/bin/bash
rm $0
echo;
IP=`wget http://members.3322.org/dyndns/getip -O - -q ; echo`;
echo -n "本LNMP脚本仅用于centos7 64位版 环境为nginx1.9开发版 mariaDB php7";echo;
echo -n "如果提示输入Y和N，请输入小写 y ";echo;
echo -n "请输入mysql的root密码，这是唯一需要的东西";echo;
read mysqlpasswd
echo "$mysqlpasswd"
yum install -y epel-release 
yum install -y wget 
rpm -Uvh http://git.oschina.net/4ker/centos7-lnmp/raw/master/remi-release-7.rpm
wget -O /etc/yum.repos.d/nginx.repo http://git.oschina.net/4ker/centos7-lnmp/raw/master/nginx.repo
wget -O /etc/yum.repos.d/MariaDB.repo http://git.oschina.net/4ker/centos7-lnmp/raw/master/MariaDB.repo
sed '0,/enabled/{ s/enabled=0/enabled=1/; }' /etc/yum.repos.d/remi-php70.repo > 1.log ;cat 1.log > /etc/yum.repos.d/remi-php70.repo ;rm 1.log -f
yum update -y
mkdir -p /var/www/html
yum install -y net-tools nginx  php-cli   php-common   php-devel  php-fpm  php-gd   php-imap  php-ldap   php-mbstring  php-mcrypt     php-mssql    php-mysqlnd  php-odbc  php-pdo    php-pear   php-pecl-jsonc    php-pecl-jsonc-devel   php-pecl-zip     php-process      php-snmp  php-soap   php-tidy     php-xml   php-xmlrpc  php-opcache  openssl openssl-devel MariaDB-server MariaDB-client
nginx.conf  default.conf
wget -O /etc/nginx/nginx.conf http://git.oschina.net/4ker/centos7-lnmp/raw/master/nginx.conf
wget -O /etc/nginx/conf.d/default.conf http://git.oschina.net/4ker/centos7-lnmp/raw/master/default.conf
wget -O /var/www/html/tz.php http://git.oschina.net/4ker/centos7-lnmp/raw/master/tz.php
wget http://git.oschina.net/4ker/centos7-lnmp/raw/master/adminer.zip
yum install zip unzip -y
unzip adminer.zip
mv adminer.php /var/www/html/adminer.php
rm -rf adminer.zip
wget -O /var/www/html/index.php http://git.oschina.net/4ker/centos7-lnmp/raw/master/1.html
chown nginx:apache  /var/www/html
firewall-cmd  --permanent --add-service=http
firewall-cmd  --permanent --add-service=https
firewall-cmd  --reload
systemctl enable mariadb.service
systemctl restart mariadb.service
systemctl enable nginx.service
systemctl restart nginx.service
systemctl enable php-fpm.service
systemctl restart php-fpm.service
/usr/bin/mysqladmin -u root password $mysqlpasswd
echo -n "安装完成，请打开$IP查看网站";echo;
echo -n "http://$IP/tz.php为探针 http://$IP/adminer.php为数据库管理工具";echo;
echo -n "安装结束~";echo;
